package JavaSE_core.IO;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;

public class Demo11 {

	public static void main(String[] args) throws Exception {
		FileWriter fw=new FileWriter("c:/b.txt");//字符输出流，使用平台默认编码
		fw.write("你好，FileWriter");
		fw.close();
	}

	private static void osw() throws FileNotFoundException, UnsupportedEncodingException, IOException {
		FileOutputStream fos=new FileOutputStream("c:/b.txt");
		OutputStreamWriter osw=new OutputStreamWriter(fos, "UTF-8");//字符输出流，并指定编码
		String s="你好，字符流!";
		osw.write(s);
		osw.close();//自动关闭fos
//		fos.close();
	}

}
